package pe.gob.sunarp.entidad;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the GRAVAMEN database table.
 * 
 */
@Embeddable
public class GravamenPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;
	private long refnumPart;
	private String numPlaca;
	private long nsGravamen;

    public GravamenPK() {
    }

	@Column(name="REFNUM_PART", unique=true, nullable=false)
	public long getRefnumPart() {
		return this.refnumPart;
	}
	public void setRefnumPart(long refnumPart) {
		this.refnumPart = refnumPart;
	}

	@Column(name="NUM_PLACA", unique=true, nullable=false, length=7)
	public String getNumPlaca() {
		return this.numPlaca;
	}
	public void setNumPlaca(String numPlaca) {
		this.numPlaca = numPlaca;
	}

	@Column(name="NS_GRAVAMEN", unique=true, nullable=false, precision=3)
	public long getNsGravamen() {
		return this.nsGravamen;
	}
	public void setNsGravamen(long nsGravamen) {
		this.nsGravamen = nsGravamen;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof GravamenPK)) {
			return false;
		}
		GravamenPK castOther = (GravamenPK)other;
		return 
			(this.refnumPart == castOther.refnumPart)
			&& this.numPlaca.equals(castOther.numPlaca)
			&& (this.nsGravamen == castOther.nsGravamen);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + ((int) (this.refnumPart ^ (this.refnumPart >>> 32)));
		hash = hash * prime + this.numPlaca.hashCode();
		hash = hash * prime + ((int) (this.nsGravamen ^ (this.nsGravamen >>> 32)));
		
		return hash;
    }
}